diff --git a/sklearn/cluster/optics_.py b/sklearn/cluster/optics_.py
index 9814a4815..e174daac2 100755
--- a/sklearn/cluster/optics_.py
+++ b/sklearn/cluster/optics_.py
@@ -394,7 +394,7 @@ class OPTICS(BaseEstimator, ClusterMixin):
         self : instance of OPTICS
             The instance.
         """
-        X = check_array(X, dtype=np.float)
+        X = check_array(X, dtype='float64')
 
         n_samples = len(X)
 
@@ -478,8 +478,10 @@ class OPTICS(BaseEstimator, ClusterMixin):
                                         working_memory=working_memory)
         slices = gen_batches(n_samples, chunk_n_rows)
         for sl in slices:
-            core_distances[sl] = neighbors.kneighbors(
-                X[sl], self.min_samples)[0][:, -1]
+            distances = neighbors.kneighbors(X[sl], self.min_samples)[0][:, -1]
+            mask = distances > self.max_eps
+            distances[mask] = np.inf
+            core_distances[sl] = distances
         return core_distances
 
     def _calculate_optics_order(self, X, nbrs):
